<?php
session_start();
$username=$_SESSION['userName'];
$password=$_SESSION['password'];
$u_id=$_SESSION['u_id'];
$gender=$_SESSION['gender'] ;
$group=$_SESSION['group'] ;
$phone=$_SESSION['phone'] ;
$address=$_SESSION['address'] ;
$birthday=$_SESSION['birthday'] ;
$occupation=$_SESSION['occupation'] ;
$blood_type=$_SESSION['blood_type'] ;
$weibo=$_SESSION['weibo'] ;
$qq=$_SESSION['qq'];
$u_image=$_SESSION['u_image'] ;
$s_question=$_SESSION['s_question'] ;
$s_answer=$_SESSION['s_answer'] ;
$mail=$_SESSION['mail'] ;
$original_password=$_POST['original_password'];
$new_password=$_POST['new_password'];
require('dbconnect.php');
if($original_password==$password){
$checksql="select * from user where name='$username'";
$check_re=mysql_query($checksql,$conn);
$num=mysql_num_rows($check_re);
$sql="update user set password='$new_password' where name='$username'";
mysql_query($sql,$conn) or die("插入数据失败: ".mysql_error());
mysql_close($conn);
echo ("<script type='text/javascript'> alert('Success!'); location.href='index.php';</script>");
}
else{
echo ("<script type='text/javascript'> alert('Failed!'); location.href='password_reset.php';</script>");
}
?>
